class SpecScriptEval {
	def static Object eval(String assertScript, Map values){
		Binding binding = new Binding()
		values.each{k, v ->
			binding.setProperty(k, v)
		}
		GroovyShell shell = new GroovyShell(binding)
		try{
			return shell.evaluate(assertScript)
		}catch(ex){
			SpecLogger.error('Groovy expression evaluate failed : ' + assertScript, ex)
			return false
		}
	}

	static pat = /^(.+)==(.+)$/
	def static Map parseAssert(String one){
		def mat = one =~ pat
		if(!mat)
			return null

		return [expression: mat[0][1], value: mat[0][2]]
	}
}
